from zxtouch.client import zxtouch
from zxtouch.toasttypes import *
import time

device = zxtouch("127.0.0.1")
device.show_toast(TOAST_MESSAGE, "Opening Notes...", 2)
time.sleep(2)
device.show_toast(TOAST_MESSAGE, "Please select an input field! 3...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Please select an input field! 2...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Please select an input field! 1...", 1)
time.sleep(1)

device.show_toast(TOAST_MESSAGE, "Inserting text...", 1.5)
device.insert_text("This text is generated by zxtouch!")
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Hiding the keyboard...", 1.5)
device.hide_keyboard()
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Move cursor to the left by 3 position", 1.5)
device.move_cursor(-3)
time.sleep(1.5)

device.show_toast(TOAST_WARNING, "Delete 3 characters...", 1.5)
device.insert_text("\b\b\b")
time.sleep(1.5)

device.disconnect()
